'\" te
.\" Copyright (C) 1990, Regents of the University of Michigan.  All Rights Reserved.
.\" Portions Copyright (C) 2003, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH LDAP_FIRST_ATTRIBUTE 3LDAP "March 10, 2023"
.SH NAME
ldap_first_attribute, ldap_next_attribute \- step through LDAP entry attributes
.SH SYNOPSIS
.nf
cc [ \fIflag\fR...] \fIfile\fR... -lldap[ \fIlibrary\fR...]
#include <lber.h>
#include <ldap.h>

\fBchar *\fR\fBldap_first_attribute\fR(\fBLDAP *\fR\fIld\fR, \fBLDAPMessage *\fR\fIentry\fR,
     \fBBerElement **\fR\fIberptr\fR);
.fi

.LP
.nf
\fBchar *\fR\fBldap_next_attribute\fR(\fBLDAP *\fR\fIld\fR, \fBLDAPMessage *\fR\fIentry\fR,
     \fBBerElement *\fR\fIber\fR);
.fi

.SH DESCRIPTION
The \fBldap_first_attribute()\fR function gets the value of the first attribute
in an entry.
.sp
.LP
The \fBldap_first_attribute()\fR function returns the name of the first
attribute in the entry. To get the value of the first attribute, pass the
attribute name to the \fBldap_get_values()\fR function or to the
\fBldap_get_values_len()\fR function.
.sp
.LP
The \fBldap_next_attribute()\fR function gets the value of the next attribute
in an entry.
.sp
.LP
After stepping through the attributes, the application should call
\fBber_free()\fR to free the \fBBerElement\fR structure allocated by the
\fBldap_first_attribute()\fR function if the structure is other than NULL.
.SH ERRORS
If an error occurs, \fINULL\fR is returned and the \fBld_errno\fR field in the
\fIld\fR parameter is set to indicate the error. See \fBldap_error\fR(3LDAP)
for a description of possible error codes.
.SH ATTRIBUTES
See \fBattributes\fR(7) for a description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
.TE

.SH SEE ALSO
.BR ldap (3LDAP),
.BR ldap_error (3LDAP),
.BR ldap_first_entry (3LDAP),
.BR ldap_get_values (3LDAP),
.BR attributes (7)
.SH NOTES
The \fBldap_first_attribute()\fR function allocates memory that might need to
be freed by the caller by means of \fBber_free\fR(3LDAP).
